package data.generators;

import data.stock.NewsCorpus;
import data.stock.NewsStory;

/**
 * The SimpleGenerator generates a news corpus of effectively blank news articles
 * at constant intervals of time, whose time-frame is constant, and whose influence
 * is a random number [-1,1]
 * @author Kevin Dolan
 */
public class SimpleCorpusGenerator implements CorpusGenerator {

	private int timeStep, timeFrame, numStories;
	
	/**
	 * @param timeStep   the time between news articles
	 * @param timeFrame  the time frame of effect
	 * @param numStories the number of stories to generate
	 */
	public SimpleCorpusGenerator(int timeStep, int timeFrame, int numStories) {
		this.timeStep = timeStep;
		this.timeFrame = timeFrame;
		this.numStories = numStories;
	}
	
	@Override
	public NewsCorpus generate() {
		NewsCorpus corpus = new NewsCorpus();
		long time = 0;
		for(int i = 0; i < numStories; i++) {
			double influence = Math.random() * 2 - 1;
			NewsStory story = new NewsStory(time, "Simple Corpus Generator", 
					"News Story #"+i, "LINEAR;"+influence+";"+timeFrame, "");
			corpus.addNews(story);
			time += timeStep;
		}		
		return corpus;
	}


}
